<?php
require_once('conf.inc.php');


$smarty = new Smarty;
$smarty->config_load('site.conf');

$dsn=DBMS.":host=".DBHOST.";dbname=".DBNAME;

class DbAccess extends PDO {
    public function __construct(){
        try {
             parent::__construct("$GLOBALS[dsn]", DBUSER, DBPASS,array(1002 => "SET NAMES utf8") );
			 parent::query("SET NAMES utf8;");
         } catch (PDOException $e) {
	         print "エラー！" . $e->getMessage() . "<br/>";
			 die();
        }
    }
    
    public final function query($sql){
        try {
			parent::query("SET NAMES utf8;");
            return parent::query($this->setString($sql));
        }catch (PDOException $e){
             print "エラー！" . $e->getMessage() . "<br/>";
			 die();
        }
    }
    
    private final function setString($sql){
        return $sql;
    }
}


?>